package final2107.day13.cglibProxy;

import org.springframework.cglib.proxy.Enhancer;

public class CglibProxyFactory {
    public static void main(String[] args) {
        //创建目标对象
        UserRegist userRegist = new UserRegist();
        //创建增强对象
        TimeCglibAspect aspect = new TimeCglibAspect(userRegist);
        //使用cglib的api方法生成代理对象
        UserRegist proxy = (UserRegist) Enhancer.create(userRegist.getClass(),aspect);
        //通过代理对象调用组合后的业务方法
        System.out.println(proxy.getClass());
        String message = proxy.regist();
        System.out.println(message);

    }
}
